﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HA.Data ;
namespace HA.ModFlow.Controls.Windows.Grids
{
    /// <summary>
    /// winVectorView.xaml 的交互逻辑
    /// </summary>
    public partial class winVectorView : Window
    {
        public winVectorView(CellCenterVector3dDS cellCenter,string name)
        {
            InitializeComponent();
            this.labDataSet.Text = name;
            this.Title = "流动向量";

          List <  HA.ModFlow.Controls.PresentationClass.DataSetValue.VectorView >vects=new  List<PresentationClass.DataSetValue.VectorView> ();
           HA.ModFlow.Controls.PresentationClass.DataSetValue.VectorView ve=new PresentationClass.DataSetValue.VectorView ();
            vects =ve .GetVectorViewData (cellCenter .Vectors );
            
            this.dtGrid.AutoGenerateColumns = false;
            this.dtGrid.CanUserAddRows = false;
            this.dtGrid.CanUserSortColumns = false;
            this.dtGrid.IsReadOnly = true;

            DataGridTextColumn txt = new DataGridTextColumn();
            txt.Header = "层";
            Binding bin = new Binding("LayerIndex");
            txt.Binding = bin;
            this.dtGrid.Columns.Add(txt);

            txt = new DataGridTextColumn();
            txt.Header = "行";
            bin = new Binding("RowIndex");
            txt.Binding = bin;
            this.dtGrid.Columns.Add(txt);

            txt = new DataGridTextColumn();
            txt.Header = "列";
            bin = new Binding("ColIndex");
            txt.Binding = bin;
            this.dtGrid.Columns.Add(txt);

            txt = new DataGridTextColumn();
            txt.Header = "vx";
            bin = new Binding("VxValue");
            txt.Binding = bin;
            this.dtGrid.Columns.Add(txt);

            txt = new DataGridTextColumn();
            txt.Header = "vy";
            bin = new Binding("VyValue");
            txt.Binding = bin;
            this.dtGrid.Columns.Add(txt);

            txt = new DataGridTextColumn();
            txt.Header = "vz";
            bin = new Binding("VzValue");
            txt.Binding = bin;
            this.dtGrid.Columns.Add(txt);

            this.dtGrid.ItemsSource = vects;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void dtGrid_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            e.Row.Header = (e.Row.GetIndex() + 1).ToString();
        }
    }
}
